# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
#
# TODO: Figure out how to ditch out Polkit (make it optional).
pkgname=fprintd
pkgver=1.94.2
pkgrel=1
pkgdesc="Daemon that provides fingerprint scanning functionality over D-Bus"
url="https://fprint.freedesktop.org/"
arch="all"
license="GPL-2.0-or-later"
depends="dbus"
makedepends="
	bash
	basu-dev
	cmd:pod2man
	gettext-dev
	libfprint-dev>=$pkgver
	linux-pam-dev
	meson
	polkit-dev
	"
checkdepends="
	dbus
	py3-cairo
	py3-dbus
	py3-dbusmock
	"
subpackages="$pkgname-doc $pkgname-lang $pkgname-pam"
source="https://gitlab.freedesktop.org/libfprint/fprintd/-/archive/v$pkgver/fprintd-v$pkgver.tar.gz
	add-test-feature-and-make-tests-optional.patch
	add-configure-option-for-libsystemd-provider.patch
	pam-include-time.patch
	pam-use-basu-and-remove-sd-login.patch
	fix-missing-libintl.patch
	"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check"  # tests are broken, they expect fprintd installed in "/"

build() {
	abuild-meson \
		-Dman=true \
		-Dgtk_doc=false \
		-Dsystemd=false \
		-Dlibsystemd=basu \
		-Dpam=true \
		-Dtest=disabled \
		output
	meson compile -C output
}

check() {
	meson test -C output --no-rebuild --print-errorlogs --no-stdsplit
}

package() {
	DESTDIR="$pkgdir" meson install -C output --no-rebuild
}

pam() {
	pkgdesc="PAM module for fingerprint authentication"

	amove lib/security
}

sha512sums="
2fd9e03446b923b29a2a915d395dc85afe10589ea5d78f047e0d3ae2a96255178589d6072c1e10ed8ac607515e410b343aef62ea551baf272999bd012c33f8e0  fprintd-v1.94.2.tar.gz
d1526a4870f38b7681a6cdfa57e380038a1203380e5c1012c162bf4ad9ff77dc62ce534b66491e12056e5b956cbd3e271934cee8268dd63890c69605f98fa905  add-test-feature-and-make-tests-optional.patch
0e4612f51b9ecaffefb407e877837633828ac4b2a40f371e11c32c0e375772a64ca2ce2a2da7de03fdbc15512a3d0b8ec9939107fc52dcd57312c153e08d8bc8  add-configure-option-for-libsystemd-provider.patch
08d489d3dce24f921777f5e90f716596aee99f8d1dfe794368bf92bd39313731225e0750375826454c22974316fd9d13b7e6405ae3f1f5b54dd418e61d512589  pam-include-time.patch
0fd20371cb710095db6ab0ca80db6308e876b44455be22f77297c756e7ed8a5292687706928f33015477ddc01b4f939ba7e111d56a90396ced863f5dc6948a84  pam-use-basu-and-remove-sd-login.patch
4e1aee3c3250924a48f45a28f2f624f15641fe9957987bdd61df8f4af1253e7d56d913570101fd05c37cd0e917be1391d44ae6ab7246119b462515e1159ad952  fix-missing-libintl.patch
"
